package xyz.xiaomeiqiu.study.starter;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import xyz.xiaomeiqiu.study.domain.Klass;
import xyz.xiaomeiqiu.study.domain.Student;

import java.util.List;

@Configuration
@EnableConfigurationProperties(Klass.class)
@ConditionalOnClass(Klass.class)
@ConditionalOnProperty(prefix = "xiaomeiqiu.school.klasses", value = "enabled", matchIfMissing = true)
public class KlassConfiguration {

    private String klassId;

    private String klassName;

    private List<Student> students;

    public Klass klass() {
        return new Klass(klassId, klassName, students);
    }
}
